import request from '@/router/axios';

/**
 * 根据工单号生成序列号
 */
export const createSequenceByWorkorder = (data) => {
  return request({
    url: '/api/mes-admin/label-product/sequence/create',
    method: 'post',
    data: data
  });
};

/**
 * 根据工单id查询生成记录
 */
export const getSourceList = (params, current, size) => {
  return request({
    url: '/api/mes-admin/sequence/generation/source',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

/**
 * 序列号增补
 */
export const sequenceAppend = (data) => {
  return request({
    url: '/api/mes-admin/label-product/append',
    method: 'post',
    data: data
  });
};

/**
 * 序列号标签打印
 */
export const sequencePrint = (data) => {
  return request({
    url: '/api/mes-admin/label-product/sequence/print',
    method: 'post',
    data: data
  });
};

/**
 * 获取包装层级
 */
export const getPackingConfigDetail = (productPackingConfigId) => {
  return request({
    url: '/api/mes-admin/productpackingconfig/detail/tree',
    method: 'get',
    params: {
      productPackingConfigId
    }
  });
};
/**
 * 生成包装条码
 */
export const createPackingSequence = (data) => {
  return request({
    url: '/api/mes-warehouse/packing/generation/normal',
    method: 'post',
    data: data
  });
};
/**
 * 增补包装条码
 */
export const appendPackingSequence = (data) => {
  return request({
    url: '/api/mes-warehouse/packing/generation/append',
    method: 'post',
    data: data
  });
};
/**
 * 获取包装条码生成记录
 */
export const getSequenceGenerationSource = (data) => {
  return request({
    url: '/api/mes-admin/sequence/generation/source',
    method: 'get',
    params: data
  });
};
/**
 * 包装条码打印
 */
export const packIdPrint = (data) => {
  return request({
    url: '/api/mes-warehouse/packing/generation/print',
    method: 'post',
    data: data
  });
};
/**
 * 产品生成数量
 */
export const sequenceGenerationSum = (data) => {
  return request({
    url: '/api/mes-admin/sequence/generation/label/generatedQuantity',
    method: 'get',
    params: data
  });
};
/**
 * 成品生成数量
 */
export const sequenceGenerationSumCP = (data) => {
  return request({
    url: '/api/mes-admin/sequence/generation/generated-product-quantity',
    method: 'get',
    params: data
  });
};
/**
 * 序列号预览
 */
export const generationPreview = (data) => {
  return request({
    url: '/api/mes-admin/label-product/sequence/preview',
    method: 'post',
    data: data
  });
};
/**
 * 原材料预览
 */
export const receivingPreview = (data) => {
  return request({
    url: '/api/mes-admin/label-material/sequence/preview',
    method: 'post',
    data: data
  });
};
/**
 * 序列号数量计算
 */
export const count = (data) => {
  return request({
    url: '/api/mes-admin/label-product/countAndGeneration',
    method: 'get',
    params: data
  });
};
/**
 * 序列号数量计算
 */
export const packcount = (data) => {
  return request({
    url: '/api/mes-warehouse/packing/count',
    method: 'get',
    params: data
  });
};

// 产品标签生产  外部自定义规则生成序列号
export const outSequenceCreate = (data) => {
  return request({
    url: '/api/mes-product/workorder/generation/normalOutSnWithoutDefinitionId',
    method: 'post',
    data: data
  });
};

// 产品标签生产  外部自定义规则重打
export const outsnReprint = (data) => {
  return request({
    url: '/api/mes-product/workorder/generation/duplicate-print-outSn',
    method: 'post',
    params: data
  });
};
